#include <stdio.h>
#include <stdlib.h>
#include <string.h>


typedef struct
{
	char data[16];
	short checksum;
}dataset;

typedef struct
{
	short flag;
	dataset data[6];
}frame;

int main(void)
{
	frame ft;
	unsigned char data[100];
	int i, j, k;
	char *pcr;
	
	frame *pfr;
	
	printf("struct size %d\n", sizeof(pfr));
	
	for (i = 0; i < 100; i++) {
		data[i] = i + 1;	// 赋值
	}
	
	k = 0;
	for (i = 0; i < 6; i++) {
		for (j = 0; j < 16; j++) {
			ft.data[i].data[j] = data[k];
			printf("%4d", data[k]);
			k++;
		}
		printf("\n");
	}
	
	pcr = (char *)&ft;	// 指向结构首地址
	ft.flag = 0x00;
	for (i = 0; i < 120; i++)
		printf("%5d", *pcr++);	// 打印出乱数据是因为结构中还有另外两个成员.	2012/11/1
		
	//putchar(0xd);
	printf("\n");
		
	return 0;
}


